<?php
/*
 * Installation procedure
 *
 * This file is responsible to install the component
 */

/**
* Function which installs the component and copies over some images needed
* to correctly display the navigation bar.
*/


	global $database, $mosConfig_absolute_path, $mosConfig_mailfrom;

	
changeIcon("JDefender","com_jdefender", "../administrator/components/com_jdefender/images/defender16.gif");
changeIcon("Show log","com_jdefender", "../administrator/components/com_jdefender/images/log16.gif");
changeIcon("Block list","com_jdefender", "../administrator/components/com_jdefender/images/blocklist16.gif");
changeIcon("Options","com_jdefender","js/ThemeOffice/config.png");
changeIcon("Restore","com_jdefender","../administrator/components/com_jdefender/images/dbrestore16.gif");
$database->setQuery("update #__jguard_options set `email`='".$mosConfig_mailfrom."' where id=1");
$database->query();


function changeIcon($name,$option,$icon,$newlink='') {
		global $database;
		$update= $newlink ? ' , `admin_menu_link` = \''.$database->getEscaped($newlink)."' " : '';
		$database->setQuery( "UPDATE #__components"
		."\n SET admin_menu_img = '".$icon."' ".$update
		."\n WHERE name = '".$name."' AND `option` = '".$option."'");
		if (!$database->query()) {
			echo $database->stderr();
		}
	}
  
?> 
